import axios from './http'
// 获取轮播图接口
export function loop(number) {
    return axios.get(`/api/weChat/applet/course/banner/list?number=${number}`)
}
// 课程类型数据接口
// function courseList(type, pageSize, pageNum=1) {
//     let formData = new FormData()
//     formData.append("type",type)
//     formData.append("pageSize",pageSize)
//     formData.append("pageNum", pageNum)

//     return axios.post(`/api/weChat/applet/course/list/type`, formData)
// }
// export { courseList }

// 直播课程接口
export function livecourse() {
    return axios.post(`/api/pc/liveCourseInfo/list`)
}
// 课程分类接口
export function classtype() {
    return axios.post(`/api/weChat/applet/subject/list`,{enable:1})
}
// 底部链接接口
function footer() {
    let form=new FormData()
        form.append("dictType","blogroll")
        form.append("pageNum","dictSort")
        form.append("pageSize",1)
        form.append("orderByColumn",10)
        form.append("isAsc","asc")
    return axios.post(`/api/system/dict/data/list/open`,form)
}
export { footer }
// 请求登录接口
export function login(username,password) {
    let form = new  FormData()
    form.append("username",username)
    form.append("password",password)
    form.append("rememberMe",true)


    return axios.post(`/api/pcUser/login`,form)
}
// 上传头像接口
// export function uploadAvatar() {
//     let form = new FormData()
//     form.append("username",username)
//     return axios.post(`/api/pcUser/updata/userAvatar`)
// }
// 查看登录用户个人信息
export function getUserMsg() {
    return axios.get(`/api/pcUser/login-user/info`)
}
// 退出登录
//查看登录用户个人信息
export  function logout() {
    return axios.get("/api/pcUser/logout")

}
// 添加评论的接口
export function comment(courseId,pageSize,pageNum) {
    return axios.get(`/api/weChat/applet/comment/commentList/course/{courseId}?courseId=${{courseId}}&&pageSize=${{pageSize}}&&pageNum=${{pageNum}}`)
}
// 获取手机号验证码
export function getCode(mobile) {
    return axios.get(`/api/pcUser/login/send/code/${mobile}`)
}
// 手机号登录 
export function mobilLogin(mobile,code) {
    let form = new FormData
    form.append("mobile", mobile)
    form.append("code", code)
    form.append("rememberMe",false)
    // form.append("rememberMe",rememberMe)
    return axios.post(`/api/pcUser/login/mobile`,form)
}
// 忘记密码时发送手机验证码
export function forGetCode(loginName,mobile) {
    let form = new FormData()
    form.append("loginName",loginName)
    form.append("mobile	",mobile)
    return axios.post(`/api/pcUser/forgetpassword/send/code`,form)
}
// 忘记密码
export function forgetPsd(loginName,password,mobile,code) {
    return axios.post(`/api/pcUser/password/forget`,{loginName,password,mobile,code})
}
